package com.yzc.menu;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @author 22875
 * @description 针对表【t_menu】的数据库操作Mapper
 * @createDate 2024-05-09 15:01:59
 * @Entity com.yzc.menu.MenuBean
 */
@Mapper
public interface MenuBeanMapper extends BaseMapper<MenuBean> {

    List<MenuBean> loadAll();


    @Update("UPDATE t_menu SET state = 1 WHERE id = #{id}")
    void deleteInfo(int id);

    List<MenuBean> selectInfosByWhere(String name);

    List<MenuBean> loadMenuTree();

    @Select("select a.*, #{userid} as userid from t_menu as a where a.parentid=0")
    List<MenuBean> loadMenuTreeByUserid(int userid);

    @Update("UPDATE t_menu SET name = #{name}, parentid = #{parentid}, " +
            "url = #{url}, icon = #{icon}, px = #{px}, memo = #{memo} WHERE id = #{id}")
    void updateInfo(MenuBean menuBean);
}




